package bavaria.hightec.testit;
import java.util.Calendar;

import bavaria.hightec.banking.*;
import bavaria.hightec.conditions.Conditions.runtime;
import bavaria.hightec.exceptions.*;
import bavaria.hightec.time.*;

public class Testit {
	
	public static void main(String[] args)  {

		
	BankImpl bank = new BankImpl();
	
    try{
    System.out.println(bank.createDepositAccount("Mustermann, Max",runtime.THREE));
    System.out.println(bank.createDepositAccount("Musterfrau, Max",runtime.SIX));
    System.out.println(bank.createDepositAccount("Muster, Max",runtime.THREE));
    System.out.println(bank.createDepositAccount("Mustermama, Max",runtime.TWELVE));
    try {
		Thread.sleep(1000);
	} catch (InterruptedException e) {
		e.printStackTrace();
	}
    System.out.println(bank.createGiroAccount("Mueller, Markus"));
    }
    catch(MaximumAccountException e){
    	System.out.println(e.getMessage());
    }
	Money money = new Money(250,Currency.EUR);
	Money money2 = new Money(1250,Currency.USD);
	Money money3 = new Money(210,Currency.EUR);
	Money money4 = new Money(500,Currency.EUR);
	
	try {
		bank.fund(1000, money, "AA");
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		bank.fund(1000, money2, "GG");
	} catch (OverCheckException e) {
		System.out.println(e.getMessage());
	}
	 catch (UnknownAccountException e1){
		 System.out.println(e1.getMessage());
	 }
	
	try {
		bank.withdraw(1000,money3,"BB");
	} catch (OverCheckException e) {
		System.out.println(e.getMessage());
	}
	catch (UnknownAccountException e1){
		 System.out.println(e1.getMessage());
	 }
	
	try {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		bank.transaction(1001, 1000, money4, "FF");
	} catch (OverCheckException e) {
		System.out.println(e.getMessage());
	}
	  catch (UnknownAccountException e1){
		 System.out.println(e1.getMessage());
	 }
	  
	  bank.setConditions(12.4, 0.5);
	try {
		bank.chargeInterest();
	} catch (OverCheckException e) {
		System.out.println(e.getMessage());
	}
	
	
	
	try{
		bank.createGiroAccount("Mueller, Marko");
	}
	catch(MaximumAccountException e){
    	System.out.println(e.getMessage());
    }
	try{
		System.out.println(bank.balance(1000));
		System.out.println(bank.balance(1001));
	}
	catch (UnknownAccountException e1){
		 System.out.println(e1.getMessage());
	 }
	bank.list();
 
	
	try{
		bank.accountString(1000);
	    bank.accountString(1001);
	}
	catch (UnknownAccountException e1){
		 System.out.println(e1.getMessage());
	 }
	
System.out.println(bank.getGiroConditions());
System.out.println(bank.getDepositConditions());

}}
